//
//  ConnectDeviceView.m
//  RONGAO
//
//  Created by ZhangYeKun on 2017/2/27.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "ConnectDeviceView.h"

@interface ConnectDeviceView ()
/** logoView **/
@property(nonatomic,strong) UIImageView *logoView;
/** 提示 **/
@property(nonatomic,strong) UILabel *tipLabel;
@end

@implementation ConnectDeviceView

- (instancetype)init{
    
    if ([super init]) {
        
        [self masLayoutSubview];
        
    }
    
    return self;
    
}

- (void)setupTipLabel:(DOORSYSTEM_TYPE)type{
    
    if (type == HAVEWINDOW) {
    
        self.tipLabel.text = @"1.请先按照说明书在设备屏幕上将设备连接至WiFi网络。\n2.开启手机WiFi，连接至与设备连接一致的WiFi网络，然后点击右上角或者下拉刷新。";
        
    }else if (type == NOWINDOW){
        self.tipLabel.text = @"1.请将设备重置，长按设备上RESET键5秒。\n2.请将手机WiFi连至设备发出的热点SMART DOOR-12346,然后点击右上角或下拉刷新。";

    }
    
}

- (UIImageView *)logoView{
    
    if (!_logoView) {
        
        __weak UIView *superView = self;
        _logoView = [[UIImageView alloc]init];
        [superView addSubview:_logoView];
        _logoView.image = [UIImage imageNamed:@"bg_67"];
        
    }
    
    return _logoView;
    
}

- (UILabel *)tipLabel{
    
    if (!_tipLabel) {
        
        __weak UIView *superView = self;
        _tipLabel = [[UILabel alloc]init];
        [superView addSubview:_tipLabel];
        _tipLabel.numberOfLines = 0;
        _tipLabel.textColor = [UIColor colorWithRed:132/255.0 green:128/255.0 blue:127/255.0 alpha:1];
        _tipLabel.font = [UIFont systemFontOfSize:14.f];
        
    }
    
    return _tipLabel;
    
}

- (void)masLayoutSubview{
    
    __weak UIView *superView = self;
    [self.logoView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(superView.mas_top).mas_offset(10.f);
        make.centerX.mas_equalTo(superView.mas_centerX);
        
    }];
    [self.tipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.mas_equalTo(self.logoView.mas_bottom).mas_offset(20.f);
        make.left.mas_equalTo(superView.mas_left).mas_offset(10.f);
        make.right.mas_equalTo(superView.mas_right).mas_offset(-10.f);
        
    }];
    
}

@end
